var request = require('request');

function done(error, results) {
	if (error) {
		throw error;
	}
	console.log('results:%j', results);
}

function fun1(next) {
	console.log('start fun1');
	request.get({
		url: 'http://www.baidu.com'
	}, function(error, res, body) {
		console.log('fun1 callback');
		next(error, 1);
	});
}

function fun2(next) {
	console.log('start fun2');
	request.get({
		url: 'http://www.baidu.com'
	}, function(error, res, body) {
		console.log('fun2 callback');
		next(error, 2);
	});
}

function fun3(next) {
	console.log('start fun3');
	request.get({
		url: 'http://abc.sadfasdfasdf.com'
	}, function(error, res, body) {
		console.log('fun3 callback');
		next(error, body);
	});
}

module.exports = {
	list:[fun1,fun2,fun3],
	
	fun1: fun1,
	fun2: fun2,
	fun3: fun3,
	done: done,

	all:{
		one:fun1,
		two:fun2,
		c:fun3 // usually use one two three as name
	}
}